//
//  dDatePickerViewController.m
//  Surveyer
//
//  Created by Qikun Guo on 13-7-30.
//  Copyright (c) 2013年 Tim. All rights reserved.
//

#import "dDatePickerViewController.h"

@interface dDatePickerViewController ()

@end

@implementation dDatePickerViewController
@synthesize titleLabel, datePicker, currentResult, currentItem;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        formatter = [[NSDateFormatter alloc] init];
        formatter.dateStyle=NSDateFormatterMediumStyle;
        formatter.timeStyle=NSDateFormatterNoStyle;
        [formatter setLocale:[NSLocale currentLocale]];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    titleLabel.text = self.currentItem.title;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)touchInside:(id)sender {
    self.editCount ++;
    if (!currentResult)
        currentResult = [[SurveyerStore defaultStore] createResultWithSurveyItem:currentItem];
    currentResult.text = [formatter stringFromDate:datePicker.date];
    
    [self.delegate currentItemCompleted:self];
}
@end
